package ooday03;

public class Test {
    public static void main(String[] args) {

        Dog[] dogs=new Dog[3];
        dogs[0]=new Dog("小白",1,"黑");
        dogs[1]=new Dog("史努比",3,"白");
        dogs[2]=new Dog("派克",6,"灰");
       // dogs[2]=null;//表示空，没有指向任何对象,发生空指针异常

        for(int i=0;i<dogs.length;i++){
            dogs[i].eat();
            dogs[i].lookHome();
        }

        Chick [] chicks=new Chick[2];
        chicks[0]=new Chick("坤坤",2,"黑衣白带");
        chicks[1]=new Chick("叫鸡",3,"棕");
        for(int i=0;i<chicks.length;i++){
            chicks[i].layEggs();
        }

        Fish[] fish=new Fish[4];
        fish[0]=new Fish("小鱼儿",1,"黄");
        fish[1]=new Fish("张顺",40,"白");
        fish[2]=new Fish("鲨鱼",10,"蓝");
        fish[3]=new Fish("老虎斑",4,"斑点");
        for(int i=0;i<fish.length;i++){
            fish[i].swim();
            fish[i].eat();
        }
    }
}
